import request from '@/utils/request';
// 课程列表接口
export function getCourseList(data:any) {
  return request("/VueHandler/CourseHandler?action=show", "post", data)
}
// 课程上架下架
export function upAndDown(ID:any) {
  return request("/VueHandler/CourseHandler?action=state", "post", { ID: ID })
}
//删除课程接口
export function delCourse(_id:any) {
  return request("/VueHandler/CourseHandler?action=delete", "post", { _id: _id })
}
//课程 置顶
export function topCourse(ID:any) {
  return request("/VueHandler/CourseHandler?action=top", "post", { ID: ID })
}
//课程基本信息添加接口
export function addCourse(data:any) {
  return request("/VueHandler/CourseHandler?action=add", "post", data)
}
// 添加目录接口
export function addDir(data:any) {
  return request("/VueHandler/CourseHandler?action=AddDirectory", "post", data)
}
// 获取课程下的目录列表
export function getCourseDir(data:any) {
  return request("/VueHandler/VideoHandler?action=finddir", "get", data)
}
// 删除目录接口
export function delDir(data:any) {
  return request("/VueHandler/CourseHandler?action=deleteDirectory", "get", data)
}
// 编辑目录接口
export function editDirApi(data:any) {
  return request("/VueHandler/CourseHandler?action=updateDirectory", "post", data)
}
// 通过id请求课程信息
export function getCourseById(ID:any) {
  return request("/VueHandler/CourseHandler?action=getcourse", "get", { ID: ID })
}
// 对应的目录下添加视频
/*
       cid: this.myCDid, //课程_id
        _id: this.mydid, //目录_id
        Vid: _id //视频_id
*/ 
export function addDirVideo(data:any) {
  return request("/VueHandler/CourseHandler?action=addvideo", "get", data)
}
// 获取目录下的视频列表
/**
 * 
 *    CDid: this.$route.query._cid, //课程_id
        _id: this._id //目录_id
 */
export function getDirVideo(data:any) {
  return request("/VueHandler/VideoHandler?action=showdir", "get", data)
}
// 删除目录下的视频
/**
 *     CDid: this.$route.query._cid,//课程的_id 
        _id: this._id,//目录id 
        Vid: _id//当前要删除的视频_id
 */
export function delDirVideo(data:any) {
  return request("/VueHandler/CourseHandler?action=delvideo", "get", data)
}

// 整个课程的添加和编辑
export function saveAllCourse(data:any) {
  return request("/VueHandler/CourseHandler?action=update", "post", data)
}